﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebApplication1.Servidor1;

namespace WebApplication1
{
    public partial class CrearCuenta : System.Web.UI.Page
    {
        Service1 servidor;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["NombreUsuario"] == null)
                Response.Redirect("Login.aspx");
            servidor = (Service1)Session["Server"];
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            int ValorCheckBox = 0;
            if (CheckBox1.Checked)
            {
                ValorCheckBox = 1;
            }

            if ((TextBox1.Text != "") && (TextBox2.Text != "") && (TextBox3.Text != ""))
            {
                String Empresa =  Session["NombreEmpresaUsuario"].ToString();
                servidor.Crear_Cuenta(TextBox3.Text,  TextBox1.Text, TextBox2.Text, ValorCheckBox, Empresa);
                Response.Redirect("VerCuentas.aspx");
            }
        }
    }
}